library(plotly)
## Loading required package: ggplot2
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
top100 <- readRDS("top100.rds")
library(ggplot2)
gg <- ggplot(top100, aes(x = title)) +
geom_point(aes(y = actual_log_revenue, text = paste("Actual:", actual_log_revenue)), color = "black") +
geom_point(aes(y = predicted_log_revenue, text = paste("Predicted:", predicted_log_revenue)), color = "red") +
geom_segment(aes(y = predicted_log_revenue, yend = actual_log_revenue, xend = title), color = "gray", linetype = "dashed") +
coord_flip() +
theme_minimal() +
labs(
title = "Actual vs Predicted Log Revenue (Top 100 Grossing Films)",
x = "Movie Title",
y = "Log10(Revenue)"
)
## Warning in geom_point(aes(y = actual_log_revenue, text = paste("Actual:", :
## Ignoring unknown aesthetics: text
## Warning in geom_point(aes(y = predicted_log_revenue, text = paste("Predicted:",
## : Ignoring unknown aesthetics: text
ggplotly(gg, tooltip = "text", width = 900, height = 1500)